import math
import random


class Circle:
    def __init__(self, x, y, r):
        self.x = x
        self.y = y
        self.r = r

    def get_length(self):
        return 2*math.pi*self.r

    def get_area(self):
        return math.pi*self.r*self.r

    def __str__(self):
        return f"圆心{self.x, self.y}  半径{self.r} 周长 {self.get_length()} 面积 {self.get_area()}"


class CircleManage:
    def __init__(self):
        self.l = []

    def add_circles(self):
        for i in range(10):
            c = Circle(random.randint(0, 5), random.randint(0, 5), random.randint(5, 10))
            d = {
                "圆心": (c.x, c.y),
                "半径": c.r,
                "周长": c.get_length(),
                "面积": c.get_area()
            }
            self.l.append(d)

    def show_circles(self):
        for e in self.l:
            print(e)

    def get_max_circle(self):
        max_circle_l = []
        max_area = None
        # max_circle = None
        for i in range(len(self.l)):
            if max_area is None:
                max_area = self.l[i]["面积"]
                # max_circle = self.l[i]
            else:
                if max_area < self.l[i]["面积"]:
                    max_area = self.l[i]["面积"]
                    # max_circle = self.l[i]
        for e in self.l:
            if max_area == e["面积"]:
                max_circle_l.append(e)
        print(f"最大面积{max_area}")
        print("#" * 20)
        # print(max_circle)
        for e in max_circle_l:
            print(f"最大的圆{e}")

    def get_max_distance(self):
        distances = []
        max_distance_circles = []
        for i in range(len(self.l)-1):
            for j in range(i+1, len(self.l)):
                distance = math.sqrt((self.l[i]["圆心"][0] - self.l[j]["圆心"][0])**2 + (self.l[i]["圆心"][1] - self.l[j]["圆心"][1])**2)
                distances.append(distance)
        max_distance = max(distances)
        print(f"最远距离{max_distance}")
        print("#" * 20)
        for i in range(len(self.l)-1):
            for j in range(i+1, len(self.l)):
                if max_distance == math.sqrt((self.l[i]["圆心"][0] - self.l[j]["圆心"][0])**2 + (self.l[i]["圆心"][1] - self.l[j]["圆心"][1])**2):
                    max_distance_circle = [self.l[i], self.l[j]]
                    max_distance_circles.append(max_distance_circle)
        for e in max_distance_circles:
            print(f"最大距离的圆{e}")


def main():
    cm = CircleManage()
    cm.add_circles()
    cm.show_circles()
    print("#"*20)
    cm.get_max_circle()
    print("#" * 20)
    cm.get_max_distance()


main()
